<!--
 * @Author: zhoujinlong 765637726@qq.com
 * @Date: 2024-04-23 08:54:49
 * @LastEditors: zhoujinlong 765637726@qq.com
 * @LastEditTime: 2024-04-23 09:15:02
 * @FilePath: \election-yd\src\renderer\src\screenHtml\screen.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!doctype html>
<html>
  <head>
    <title>Selection Area</title>
    <style>
      html,
      body {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
      }
    </style>
  </head>
  <body>
    <!-- <script src="./screen.js"></script> -->
    <script>
      //   const { ipcRenderer } = require('electron')
      //   import { ipcRenderer } from 'electron
    //   const { ipcRenderer } = require('../../../../node_modules/@electron')

      console.log('window',window);

      document.addEventListener('mousedown', function (event) {
        const startX = event.x
        const startY = event.y

        document.addEventListener('mousemove', onMouseMove)
        document.addEventListener('mouseup', onMouseUp)

        function onMouseMove(moveEvent) {
          const width = Math.abs(moveEvent.x - startX)
          const height = Math.abs(moveEvent.y - startY)
          // Update the selection overlay here

          console.log('window',window);
        }

        function onMouseUp(upEvent) {
          document.removeEventListener('mousemove', onMouseMove)
          document.removeEventListener('mouseup', onMouseUp)
        //   ipcRenderer.send('capture-screen', {
        //     x: Math.min(startX, upEvent.x),
        //     y: Math.min(startY, upEvent.y),
        //     width: Math.abs(upEvent.x - startX),
        //     height: Math.abs(upEvent.y - startY)
        //   })
        }
      })
    </script>
  </body>
</html>
